package cn.qrx.gateway.datasource.unpooled;

import cn.qrx.gateway.datasource.DataSource;
import cn.qrx.gateway.datasource.DataSourceFactory;
import cn.qrx.gateway.datasource.DataSourceType;
import cn.qrx.gateway.seesion.Configuration;

/**
 * @Author: 屈燃希
 * @Date: 2025/10/20
 * @Version: V1.0
 * @Description:
 */
public class UnpooledDataSourceFactory implements DataSourceFactory {


    private UnpooledDataSource dataSource ;

    public UnpooledDataSourceFactory() {
        dataSource = new UnpooledDataSource();
    }

    @Override
    public DataSource getDataSource() {
        return dataSource;
    }

    @Override
    public void setProperties(Configuration configuration, String uri) {
        this.dataSource.setConfiguration(configuration);
        this.dataSource.setHttpStatement(configuration.getHttpStatement(uri));
        this.dataSource.setDataSourceType(DataSourceType.DUBBO);
    }
}
